how to calculate sum of natural numbers